<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/<spring:theme code="stylesheet.sidebar" />" />

<div id="sidebar">
    <div class="">
        <ul class="nav nav-pills nav-stacked nav-canvas">
            <li  nav="index">
                <a href="#"><i class="glyphicon glyphicon-home"></i><span><spring:message code="docrepository.nav.index" /></span></a>
            </li>
            <li nav="category">
                <a href="<c:url value="/category" />"><i class="glyphicon glyphicon-folder-open"></i><span><spring:message code="docrepository.nav.category" /></span></a>
            </li>
            <li nav="member">
                <a href="#"><i class="glyphicon glyphicon-user"></i><span><spring:message code="docrepository.nav.member" /></span></a>
            </li>
            <li class="nav-accordion">
                <a href="#"><i class="glyphicon glyphicon-cog"></i><span><spring:message code="docrepository.nav.setting" /></span></a>
                <ul class="nav nav-pills nav-stacked">
                    <li nav="setting.sysconfig">
                        <a href="#"><span><spring:message code="docrepository.nav.setting.sysconfig" /></span></a>
                    </li>
                    <li nav="setting.theme">
                        <a href="#"><span><spring:message code="docrepository.nav.setting.theme" /></span></a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>
</div>

<script type="text/javascript">
    (function(){
    	$(document).ready(function(){
    		// 所有导航
    		var navs = $('li[nav]', '.nav-canvas');
    		if(navs && navs.length>0){
    			var curNav = navs[0];
    			// 当前请求的nav
        		var nav = '${nav}';
        		if(nav){
        			curNav = $('li[nav="' + nav + '"]', '.nav-canvas');
        		}
        		if(curNav){
        			$(curNav).addClass('active');
        		}
    		}
    		
    		// nav-accordion 手风琴效果
    		$('.nav-accordion>a').click(function(e){
    			e.preventDefault();
    			var $ul = $(this).siblings('ul');
    			var $parent = $(this).parent();
    			
    			// 当前菜单的显示和隐藏
    			//$ul.is(':visible') ? $parent.removeClass('active') : $parent.addClass('active');;
    			$ul.slideToggle();
    		});
    	});
    })(jQuery);
</script>